package com.jinhongone.pattern.creater.factory.before;

public class CoffeeStore {

    public  Coffee orderCoffee(String type) {
        //CoffeeStore 依赖于 Coffee
        Coffee coffee;
        switch (type) {
            case "american":
                coffee = new AmericanCoffee();
                break;
            case "latte":
                coffee = new LatteCoffee();
                break;
            default:
                throw new RuntimeException("本店没有该类coffee");
        }
        coffee.addSugar();
        coffee.addMilk();
        return coffee;
    }
}
